/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.bff.designtime.generator.core.rtgen.managergenerator.assembler.method;

import com.inspur.edp.bff.spi.action.changemapping.DefaultChangeMapAction;
import com.inspur.edp.bff.spi.action.changemapping.DefaultChangeReversalAction;
import com.inspur.edp.bff.spi.action.datamapping.DefaultDataMappingAction;
import com.inspur.edp.bff.spi.action.datamapping.DefaultDataReversalAction;
import com.inspur.edp.bff.spi.action.delete.DefaultDeleteAction;
import com.inspur.edp.bff.spi.action.modify.DefaultModifyAction;
import com.inspur.edp.bff.spi.action.multidelete.DefaultMultiDeleteAction;
import com.inspur.edp.bff.spi.action.query.DefaultQueryAction;
import com.inspur.edp.bff.spi.action.retrieve.DefaultRetrieveAction;
import com.inspur.edp.bff.spi.action.retrievedefault.DefaultRetrieveDefaultAction;
import com.inspur.edp.formserver.viewmodel.common.InternalExtendActionUtil;

import java.util.HashMap;

public class DefaultActionUtils {

    private static HashMap<String, Class> defaultActionType;


    public static HashMap<String, Class> getDefaultActionType() {
        if(defaultActionType == null){
            initDefaultActionType();
        }
        return defaultActionType;
    }

    private static void initDefaultActionType(){
        defaultActionType = new HashMap<>();
        defaultActionType.put(InternalExtendActionUtil.QueryActionId, DefaultQueryAction.class);
        defaultActionType
                .put(InternalExtendActionUtil.DataMappingActionId, DefaultDataMappingAction.class);
        defaultActionType
                .put(InternalExtendActionUtil.DataReversalMappingActionId, DefaultDataReversalAction.class);
        defaultActionType.put(InternalExtendActionUtil.RetrieveActionId, DefaultRetrieveAction.class);
        defaultActionType
                .put(InternalExtendActionUtil.CreateActionId, DefaultRetrieveDefaultAction.class);
        defaultActionType.put(InternalExtendActionUtil.ModifyActionId, DefaultModifyAction.class);
        defaultActionType.put(InternalExtendActionUtil.DeleteActionId, DefaultDeleteAction.class);
        defaultActionType.put(InternalExtendActionUtil.MultiDeleteActionId, DefaultMultiDeleteAction.class);
        defaultActionType
                .put(InternalExtendActionUtil.ChangesetMappingActionId, DefaultChangeMapAction.class);
        defaultActionType.put(InternalExtendActionUtil.ChangesetReversalMappingActionId,
                DefaultChangeReversalAction.class);
    }
}
